<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="gae.colopl.*" %>
<%@ page import="gae.colopl.bean.*" %>
<%@ page import="java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- The HTML 4.01 Transitional DOCTYPE declaration-->
<!-- above set at the top of the file will set     -->
<!-- the browser's rendering engine into           -->
<!-- "Quirks Mode". Replacing this declaration     -->
<!-- with a "Standards Mode" doctype is supported, -->
<!-- but may lead to some differences in layout.   -->

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>Hello App Engine</title>
  </head>
  
  <body>
    <h2>お土産一括ギフト</h2>
    <div>ギフトするコロニーの選択</div>
    <br>
    <form method="POST" action="<%=response.encodeUrl("selectArea.do") %>">
      <div>直接コロニー番号を入力<input type="text" name ="toID"></div>
      <input type="submit" value="選択">
    </form>
    
<table border=1>
 <caption>ご近所にいるリンクコロニー</caption>
 <tr bgcolor="#cccccc">
  <th>ｺﾛﾆｰ番号</th>
  <th>ﾆｯｸﾈｰﾑ</th>
 </tr>
 
    <%
  User user = (User)session.getAttribute("userInfo");
  List<ColonyLink> near = (List<ColonyLink>)session.getAttribute("near.friend.colony");
  if (near != null) {
	 if (near.size() > 0) {
	     for (int i = 0; i < near.size(); i++) {
	         ColonyLink link = near.get(i);
	         String linkUrl = response.encodeUrl("selectArea.do?toID=" + link.getId());
	%>
	<tr align=center>
    <td><a href="<%=linkUrl %>">第<%=link.getId() %>ｺﾛﾆｰ</a></td>
	<td><%=link.getNickname() %></td>
  </tr>
    <%
	     }
	 }
  }
    %>
</table>
<br>


<table border=1>
 <caption>招待したコロニー</caption>
 <tr bgcolor="#cccccc">
  <th>ｺﾛﾆｰ番号</th>
  <th>ﾆｯｸﾈｰﾑ</th>
 </tr>
 
    <%
  List<ColonyLink> invited = (List<ColonyLink>)session.getAttribute("invited.friend.colony");
  if (invited != null) {
	 if (invited.size() > 0) {
	     for (int i = 0; i < invited.size(); i++) {
	         ColonyLink link = invited.get(i);
	         String linkUrl = response.encodeUrl("selectArea.do?toID=" + link.getId());
	%>
	<tr align=center>
    <td><a href="<%=linkUrl %>">第<%=link.getId() %>ｺﾛﾆｰ</a></td>
	<td><%=link.getNickname() %></td>
  </tr>
    <%
	     }
	 }
  }
    %>
</table>
<br>
    <form method="POST" action="<%=response.encodeUrl("selectColonyForSouvenir.do") %>">
      <input type="submit" value="キャッシュのリフレッシュ">
      <input type="hidden" name ="type" value="refresh">
    </form>
    <!-- 
    <div><a href="<%=response.encodeUrl("searchWareHouse.do?type=doc") %>">使い方</a></div>
     -->
    <div><a href="<%=response.encodeUrl("menu.do") %>">メニュー</a></div>
    <br>
    <div><a href="<%=response.encodeUrl("logout.do") %>">ログアウト</a></div>
<br>
  </body>
</html>
